﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Tourreau.Gilles.FaxDotNet;
namespace FaxTest
{
    class Program
    {
        static void Main(string[] args)
        {
            short i=0;
            Console.WriteLine("Etat d'établissement de la connexion avec le fax : " + FaxServer.TestConnection(""));
            Console.WriteLine("FaxServer est-il installé ? : " + FaxServer.IsFaxServiceInstalled.ToString());
            //Se connecter au faxserver
            using (FaxServer server = new FaxServer("", "Fax"))
            {
                FaxInformations info;
                FaxJob job;

                info = server.GetDefaultInformations();
                info.RecipientName = "test";
                info.RecipientNumber = "0522984826";
                //info.BillingCode = "";
                //info.SenderCompany = "";
                //info.CoverPage.RecipientCity = "";
                //info.CoverPage.RecipientCompany = "";
                //info.CoverPage.RecipientCountry = "";
                //info.CoverPage.RecipientName = "";  
                info.CoverPage.CoverPageName = "Urgent";
                info.CoverPage.SenderFaxNumber = "05 00 00 00 00";
                info.CoverPage = null;                

                job = server.Send(info, @"C:\test.txt");
                do
                {                    
                    System.Threading.Thread.Sleep(5000);
                    server.RefreshJobs();
                    Console.WriteLine("Statut de l'envoi après " + i +"s: "+ job.Status.ToString());
                    i+=5;
                }
                while (i < 60);
                Console.ReadLine();
            }
        }
    }
}
